package cn.tedu.oop;

/*本类用于OOP巩固练习*/
public class TestCar {
    public static void main(String[] args) {
        //4.1创建汽车类的对象c1,设置汽车属性:
        Car c1 = new Car();
        c1.brand = "宝马";
        c1.color = "五彩斑斓的黑";
        c1.speed = 100.1;
        c1.id = 666;
        c1.load = 4;
        //4.2创建汽车类的对象c2,设置汽车属性:
        Car c2 = new Car();
        c2.brand = "特斯拉";
        c2.color = "黑不溜秋的白";
        c2.speed = 120.5;
        c2.id = 34;
        c2.load = 2;
        //5.1查看c2对象的所有属性值
        System.out.println(c2.brand);
        System.out.println(c2.id);
        System.out.println(c2.color);
        System.out.println(c2.load);
        System.out.println(c2.speed);
        //5.2通过c1对象调用汽车类的方法
        c1.start();
        c1.stop();
    }
}

//1.定义汽车类型Car
class Car {
    //2.定义汽车类型的各种属性
    //品牌brand 颜色color 速度speed 编号id 载客量load
    String brand;
    String color;
    double speed;
    int id;//后面用包装类型Integer
    int load;

    //3.定义汽车类的启动功能start(),打印:我的小车车启动啦~
    public void start(){
        System.out.println("我的小车车启动啦~");
        stop();
    }
    //4.定义汽车类的停止功能stop(),打印:唉呀妈呀熄火了~
    public void stop(){
        System.out.println("唉呀妈呀熄火了~");
        start();
    }
}






